<!DOCTYPE html>
<html>
<head>
    {include file="public/header" /}

</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layuimini-main">

        <form class="layui-form" action="">

            <div class="layui-form-item">
                <label class="layui-form-label">appid</label>
                <div class="layui-input-block">
                    <input type="text" disabled name="appid" value="{$info.appid}" lay-verify="require" autocomplete="off" placeholder="请输入appid" class="layui-input iwidth" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">下载地址</label>
                <div class="layui-input-block">
                    <input type="text" name="url" value="{$info.url}" lay-verify="require" autocomplete="off" placeholder="请输入下载地址" class="layui-input iwidth" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">版本号</label>
                <div class="layui-input-block">
                    <input type="text" name="version" value="{$info.version}" lay-verify="require" autocomplete="off" placeholder="请输入版本号" class="layui-input iwidth" >
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">更新说明</label>
                <div class="layui-input-block">
                    <input type="text" name="note" value="{$info.note}" lay-verify="require" autocomplete="off" placeholder="请输入更新说明" class="layui-input iwidth" >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">版本大小</label>
                <div class="layui-input-inline">
                    <input type="number" name="size" value="{$info.size}" lay-verify="require" autocomplete="off" placeholder="请输入版本大小（单位：M）" class="layui-input iwidth" >
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="add">立即提交</button>
                </div>
            </div>
        </form>

    </div>
</div>

{include file="public/footer" /}

<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , $ = layui.$;

        //监听指定开关
        form.on('switch(switchTest)', function (data) {
            layer.msg('开关checked：' + (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

        //监听提交
        form.on('submit(add)', function (data) {
            $.ajax({
                url: '/admin/systemset/versionctrl?active=ajax',
                type: 'post',
                dataType: 'json',
                data: data.field,
                success: function (res) {
                    if (res.status == true) {    // 获得frame索引
                        parent.layer.msg(res.msg, {icon:1,time: 1000}, function () {
                            //重新加载父页面
                           location.reload();
                        });
                        return;
                    } else{
                        layer.msg(res.msg, {icon:5,time: 1000}, function () {
                        });
                    }
                },
                error: function () {
                    layer.msg("报错了");
                }
            });
            return false;
            /*layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })*/
        });




    });
</script>
<!--图片上传-->
</body>
</html>